package demo1;

public class Test2 {
    public static void main(String[] args) throws InterruptedException {
        Thread[] thread = new Thread[20];
        for(int i = 0; i < thread.length; i++){
            final int n = i;
            thread[i] = new Thread(() ->{
                System.out.println(n);
            });
        }
        for(int i = 0; i < thread.length; i++){
            thread[i].start();
            thread[i].join();
        }
        System.out.println("ok~");
    }
}
